package com.utils.lib.activity;

import android.content.Intent;
import android.support.v4.app.FragmentActivity;
import android.os.Bundle;
import android.view.View;
import android.view.WindowManager;
import android.widget.TextView;

import com.jaeger.library.StatusBarUtil;
import com.utils.lib.R;

/**
 * 展示《个人信息保护政策》页面
 */
public class PrivacyPolicyActivity extends FragmentActivity {
    private static final String APP_NAME = "APP_NAME";
    private static final String BG_COLOR = "bgColor";

    public static void starActivity(FragmentActivity activity, String appName, int bgColor) {
        Intent intent = new Intent(activity, PrivacyPolicyActivity.class);
        intent.putExtra(APP_NAME, appName);
        intent.putExtra(BG_COLOR, bgColor);
        activity.getWindow().setFlags(
                WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN
        );
        activity.startActivity(intent);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
//        overridePendingTransition(R.anim.out, 0);
        //无title
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_privacy_policy);
        String appName = getIntent().getStringExtra(APP_NAME);
        int color = getIntent().getIntExtra(BG_COLOR, getResources().getColor(R.color.u_default_color));
        StatusBarUtil.setColor(this,color,25);
        View view = findViewById(R.id.u_fl_title_layout);
        TextView v = findViewById(R.id.u_tv_content);
        view.setBackgroundColor(color);
        findViewById(R.id.u_iv_back).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
        v.setText(getResources().getString(R.string.u_regulation).replace("XXX（APP名称）", appName));
    }
}
